package com.ask.apiLake;

import com.ask.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/cache")
@Slf4j
public class SpringCacheController {

    @GetMapping
    @Cacheable(value = "myCache", key = "#cacheKey")
    public Result<String> getCache(String cacheKey, String cacheValue) {
        log.info("cacheKey :{}, cacheValue:{}", cacheKey, cacheValue);
        return Result.success(cacheValue);
    }
}
